#ifndef _PLANTCLIENT_H_
#define _PLANTCLIENT_H_

#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include "plant.h"

#define PlantClient_max_com_buf 1000

class PlantClient
{
public:
  PlantClient(Plant* plant);

  /* initialize TCP connection to CLSquare server */
  bool init(const char* fname=0);
  
  bool run();
  
  /* close TCP connection to CLSquare server */
  bool deinit();
  
protected:
  int port;
  char hostname[1000];  
  int socket_id;
  struct sockaddr_in adresse;
  struct in_addr ip;
  struct hostent* server;
  char information[PlantClient_max_com_buf]; 
  
  int x_dim; // dimension of state space
  int o_dim; // dimension of observable state space
  int u_dim; // dimension of action space
  
  double* state;
  double* target_state;
  double* next_state;
  double* action;
  double* observation;
  
  Plant* plant;  
  
  void read_options(const char* fname) ;
};

#endif /*CLIENT_H_*/
